package com.zh.note.huawei.onehundred.补种未成熟的胡杨柳;

import java.util.Scanner;

/**
 * @Author: zhanghuan
 * @date: 2023/9/12 09:13
 * @description: create it
 */
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int m = sc.nextInt();
        sc.nextLine();
        String line = sc.nextLine();
        String[] strs = line.split(" ");
        int[] rolls = new int[n];
        int k = sc.nextInt();
        for (String str : strs) {
            int num = Integer.parseInt(str);
            if (num <= n) {
                rolls[num - 1] = 1;
            }
        }
        int left = 0;
        int right = 0;
        int count = 0;
        int result = 0;
        while (right < n) {
            while (right < n && count <= k) {
                if (rolls[right] == 1) {
                    count++;
                }
                right++;
                if (count <= k) {
                    result = Math.max(right - left, result);
                }
            }

            while (left <= right && count > k) {
                if (rolls[left] == 1) {
                    count--;
                }
                left++;
            }

        }
        System.out.println(result);
    }
}
